<?php


namespace app\admin\controller;

use DI\Annotation\Inject;
use support\annotation\NoNeedRight;
use support\Request;

/**
 * @NoNeedRight()
 */
class Commond extends BaseController
{

    /**
     * @var \app\admin\service\Attachment
     * @Inject()
     */
    protected $attachment = null;

    public function upload(request $request)
    {
        $file = $request->file('file');
        $path = $this->attachment->init($file)->upload();
        $this->success("上传成功", [
            'path' => $path
        ]);
    }

    public function getconfig(request $request) {
        $this->success("", [
            'domain' => $request->host(true),
            'port' => config('gateway.gateway.port')
        ]);
    }
}
